home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261c.zoo / objects / Storage.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-19  |  2.5 KB  |  86 lines

  1. /* Interface for Objective C NeXT-compatible Storage object
  2.    Copyright (C) 1993,1994 Free Software Foundation, Inc.
  3.  
  4.    Written by:  Kresten Krab Thorup <krab@iesd.auc.dk>
  5.    Dept. of Mathematics and Computer Science, Aalborg U., Denmark
  6.  
  7.    This file is part of the GNU Objective C Class Library.
  8.  
  9.    This library is free software; you can redistribute it and/or
  10.    modify it under the terms of the GNU Library General Public
  11.    License as published by the Free Software Foundation; either
  12.    version 2 of the License, or (at your option) any later version.
  13.    
  14.    This library is distributed in the hope that it will be useful,
  15.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.    Library General Public License for more details.
  18.  
  19.    You should have received a copy of the GNU Library General Public
  20.    License along with this library; if not, write to the Free
  21.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */ 
  23.  
  24. /******************************************************************
  25.   TODO:
  26.    Does not implement methods for archiving itself.
  27. ******************************************************************/
  28.  
  29. #ifndef __Storage_h_INCLUDE_GNU
  30. #define __Storage_h_INCLUDE_GNU
  31.  
  32. #include <objc/Object.h>
  33.  
  34. @interface Storage : Object
  35. {
  36. @public
  37.     void     *dataPtr;    /* data of the Storage object */
  38.     const char  *description;    /* Element description */
  39.     unsigned     numElements;    /* Actual number of elements */
  40.     unsigned     maxElements;    /* Total allocated elements */
  41.     unsigned    elementSize;    /* Element size */
  42. }
  43.  
  44. /* Creating, freeing, initializing, and emptying */
  45.  
  46. - init;
  47. - initCount:(unsigned)numSlots elementSize:(unsigned)sizeInBytes
  48.   description:(const char*)elemDesc;
  49. - free;
  50. - empty;
  51. - shallowCopy;
  52.  
  53. /* Manipulating the elements */
  54.  
  55. - (BOOL)isEqual: anObject;
  56. - (const char *)description; 
  57. - (unsigned)count; 
  58. - (void *)elementAt:(unsigned)index; 
  59. - replaceElementAt:(unsigned)index with:(void *)anElement;
  60. - setNumSlots:(unsigned)numSlots; 
  61. - setAvailableCapacity:(unsigned)numSlots;
  62. - addElement:(void *)anElement; 
  63. - removeLastElement; 
  64. - insertElement:(void *)anElement at:(unsigned)index; 
  65. - removeElementAt:(unsigned)index; 
  66.  
  67. /* Archiving */
  68.  
  69. - write:(TypedStream *)stream;
  70. - read:(TypedStream *)stream;
  71.  
  72. /* old-style creation */
  73.  
  74. + new; 
  75. + newCount:(unsigned)count elementSize:(unsigned)sizeInBytes 
  76.  description:(const char *)descriptor; 
  77.  
  78. @end
  79.  
  80. typedef struct {
  81.     @defs(Storage)
  82.   } NXStorageId;
  83.  
  84.  
  85. #endif /* __Storage_h_INCLUDE_GNU */
  86.